<include file="public@header">
<body>
    <div class="indexbg headhead">
        <form action="" method="post" class="layui-form">
        <h3 class="mytitle" style="position: relative;left: -0.4rem;">{:lang('Modify login password')}</h3>
        <div class="infshowall">
            <div class="infshow">
                <p>{:lang('Old password')}</p>
                <input type="text" name="old_password" placeholder="{:lang('Please enter the old password')}">
            </div>
            <div class="infshow">
                <p>{:lang('New password')}</p>
                <input type="text" name="password" placeholder="{:lang('Please enter a new password')}">
            </div>
            <div class="infshow">
                <p>{:lang('Confirm password')}</p>
                <input type="text" name="repassword" placeholder="{:lang('Please confirm new password')}">
            </div>
        </div>
        <button class="emailbtn" lay-submit>{:lang('Submit')}</button>
        </form>
    </div>
    <script src="__STATIC__/hybit/js/jquery.min.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script>
        layui.use(['form','layer'],function(){
            var layer = layui.layer,
                form = layui.form;

            //监听提交
            form.on('submit', function(data){
                var _this = $(this);
                _this.attr("disabled",true);
                $.ajax({
                    type: 'post',
                    url: '{:url("user/profile/passwordPost")}',
                    data: data.field,
                    success:function(res){
                        layer.msg(res.msg)
                        if(res.code == 1){
                            setTimeout(function(){ window.history.go(-1); }, 1500);
                        }else{
                            _this.removeAttr("disabled");
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>